package com.xquant.marketdata.curvestrip.controller;

import com.github.pagehelper.PageInfo;
import com.xquant.marketdata.curvestrip.service.IrCurveInterpolationService;
import com.xquant.marketdata.utils.CommResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 利率曲线插值
 *
 * @Author yunnuo.yang
 */
@RestController
@RequestMapping("irCurveInterpolation")
public class IrCurveInterpolationController {

    @Autowired
    private IrCurveInterpolationService irCurveInterpolationService;


    /**
     * 计算完成后的返回结果
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/calculateCurvesReturn.action")
    public PageInfo<Map> calculateCurvesReturn(@RequestParam Map<String, Object> param) {

        PageInfo<Map> pageInfo = irCurveInterpolationService.calculateCurvesRatesByPage(param);

        return pageInfo;
    }

    /**
     * 计算完成后的返回结果
     *
     * @param param
     * @return
     */
    @PostMapping(value = "/calculateCurvesSave.action")
    public CommResponse calculateCurvesSave(@RequestParam Map<String, Object> param) {

        irCurveInterpolationService.calculateCurvesSaveByPage(param);

        return new CommResponse(true, "保存成功");
    }


}
